var verify_item_within_restrict_list = JSON.parse('{"CODE":0, "ACTION":"","LEVEL":"T1", "MSG":"","DATA":"","SCRIPTNAME":"verify_item_within_restrict_list"}');
var withinRestrictListFlag = false

if (!isNull(retail_tax) || !isNull(cost)) {
    var oneKeyColorList = 'GSL,VMI,DSV,G,V,D'.toUpperCase().split(',')
    var color = '';

    if (!isNull(item_attributes)) {
        color = item_attributes.get('color');
    }
    if (isNull(color) || oneKeyColorList.indexOf(color.toUpperCase()) == -1) {
        if (!isNull(retail_tax)) {
            var retailStartDateForRestrict = getNewBeginDate(new Date(retail_start_date));
            var retailEndDateForRestrict = '';
            if (isNull(retail_end_date)) {
                retailEndDateForRestrict = getNewEndDate(new Date('2049-12-31'));
            } else {
                retailEndDateForRestrict = getNewEndDate(new Date(retail_end_date));
            }
            var restrict_list_retail_or_cost = func_item_within_restrict_list_retail_or_cost(itemRestrictList, trait_store, retailStartDateForRestrict, retailEndDateForRestrict, item_nbr, trait_nbr, store_id);
            if (restrict_list_retail_or_cost) {
                withinRestrictListFlag = true;
            }
        }

        if (!isNull(cost) && !withinRestrictListFlag) {
            var retailStartDateForRestrict = getNewBeginDate(new Date(cost_start_date));
            var retailEndDateForRestrict = '';
            if (isNull(retail_end_date)) {
                retailEndDateForRestrict = getNewEndDate(new Date('2049-12-31'));
            } else {
                retailEndDateForRestrict = getNewEndDate(new Date(cost_end_date));
            }
            var restrict_list_retail_or_cost = func_item_within_restrict_list_retail_or_cost(itemRestrictList, trait_store, retailStartDateForRestrict, retailEndDateForRestrict, item_nbr, trait_nbr, store_id);
            if (restrict_list_retail_or_cost) {
                withinRestrictListFlag = true;
            }
        }
    }
}

if (withinRestrictListFlag) {
    verify_item_within_restrict_list.CODE = 2;
    verify_item_within_restrict_list.ACTION = 'error';
    verify_item_within_restrict_list.MSG = '禁售商品的售价和成本不可修改';
}
JSON.stringify(verify_item_within_restrict_list);